package vcp.server.factories;

import vcp.server.DAO.CarDAO;
import vcp.server.DAO.ComplaintDAO;
import vcp.server.DAO.ComplaintHistoryDAO;
import vcp.server.DAO.CustomerDAO;
import vcp.server.DAO.DayStatisticsDAO;
import vcp.server.DAO.LotDAO;
import vcp.server.DAO.PeriodicReportDAO;
import vcp.server.DAO.SiteCostUpdatesDAO;
import vcp.server.DAO.SiteDAO;
import vcp.server.DAO.SubscriptionDAO;
import vcp.server.DAO.SubscriptionHistoryDAO;
import vcp.server.DAO.UserDAO;
import vcp.server.DAO.WeekStatisticsDAO;
import vcp.server.DAO.WorkerDAO;
import vcp.server.utility.Constants.TableNames;

public class MySQLDAOFactory extends DAOFactoryAbstract
{
	public MySQLDAOFactory()
	{
		super();
	}

	@Override
	public UserDAO getUserDAO()
	{
		if (!this.daoMap.containsKey(TableNames.USER))
		{
			this.daoMap.put(TableNames.USER, new UserDAO());
		}
		return (UserDAO) this.daoMap.get(TableNames.USER);
	}

	@Override
	public WorkerDAO getWorkerDAO()
	{
		if (!this.daoMap.containsKey(TableNames.WORKER))
		{
			this.daoMap.put(TableNames.WORKER, new WorkerDAO());
		}
		return (WorkerDAO) this.daoMap.get(TableNames.WORKER);
	}

	@Override
	public CustomerDAO getCustomerDAO()
	{
		if (!this.daoMap.containsKey(TableNames.CUSTOMER))
		{
			this.daoMap.put(TableNames.CUSTOMER, new CustomerDAO());
		}
		return (CustomerDAO) this.daoMap.get(TableNames.CUSTOMER);
	}

	@Override
	public CarDAO getCarDAO()
	{
		if (!this.daoMap.containsKey(TableNames.CARS))
		{
			this.daoMap.put(TableNames.CARS, new CarDAO());
		}
		return (CarDAO) this.daoMap.get(TableNames.CARS);
	}

	@Override
	public SubscriptionDAO getSubscriptionDAO()
	{
		if (!this.daoMap.containsKey(TableNames.SUBSCRIPTION))
		{
			this.daoMap.put(TableNames.SUBSCRIPTION, new SubscriptionDAO());
		}
		return (SubscriptionDAO) this.daoMap.get(TableNames.SUBSCRIPTION);
	}

	@Override
	public SubscriptionHistoryDAO getSubscriptionHistoryDAO()
	{
		if (!this.daoMap.containsKey(TableNames.SUBSCRIPTIONHISTORY))
		{
			this.daoMap.put(TableNames.SUBSCRIPTIONHISTORY, new SubscriptionHistoryDAO());
		}
		return (SubscriptionHistoryDAO) this.daoMap.get(TableNames.SUBSCRIPTIONHISTORY);
	}

	@Override
	public ComplaintDAO getComplaintDAO()
	{
		if (!this.daoMap.containsKey(TableNames.COMPLAINT))
		{
			this.daoMap.put(TableNames.COMPLAINT, new ComplaintDAO());
		}
		return (ComplaintDAO) this.daoMap.get(TableNames.COMPLAINT);
	}

	@Override
	public ComplaintHistoryDAO getComplaintHistoryDAO()
	{
		if (!this.daoMap.containsKey(TableNames.COMPLAINT_HISTORY))
		{
			this.daoMap.put(TableNames.COMPLAINT_HISTORY, new ComplaintHistoryDAO());
		}
		return (ComplaintHistoryDAO) this.daoMap.get(TableNames.COMPLAINT_HISTORY);
	}

	@Override
	public SiteDAO getSiteDAO()
	{
		if (!this.daoMap.containsKey(TableNames.SITE))
		{
			this.daoMap.put(TableNames.SITE, new SiteDAO());
		}
		return (SiteDAO) this.daoMap.get(TableNames.SITE);
	}

	@Override
	public SiteCostUpdatesDAO getSiteCostUpdatesDAO()
	{
		if (!this.daoMap.containsKey(TableNames.SITE_COSTS_UPDATE))
		{
			this.daoMap.put(TableNames.SITE_COSTS_UPDATE, new SiteCostUpdatesDAO());
		}
		return (SiteCostUpdatesDAO) this.daoMap.get(TableNames.SITE_COSTS_UPDATE);
	}

	@Override
	public LotDAO getLotDAO()
	{
		if (!this.daoMap.containsKey(TableNames.LOT))
		{
			this.daoMap.put(TableNames.LOT, new LotDAO());
		}
		return (LotDAO) this.daoMap.get(TableNames.LOT);
	}

	@Override
	public PeriodicReportDAO getPeriodicReportDAO()
	{
		if (!this.daoMap.containsKey(TableNames.PERIODIC_REPORT))
		{
			this.daoMap.put(TableNames.PERIODIC_REPORT, new PeriodicReportDAO());
		}
		return (PeriodicReportDAO) this.daoMap.get(TableNames.PERIODIC_REPORT);
	}

	@Override
	public DayStatisticsDAO getDayStatisticsDAO()
	{
		if (!this.daoMap.containsKey(TableNames.DAY_STATISTICS))
		{
			this.daoMap.put(TableNames.DAY_STATISTICS, new DayStatisticsDAO());
		}
		return (DayStatisticsDAO) this.daoMap.get(TableNames.DAY_STATISTICS);
	}

	@Override
	public WeekStatisticsDAO getWeekStatisticsDAO()
	{
		if (!this.daoMap.containsKey(TableNames.WEEKLY_STATISTICS))
		{
			this.daoMap.put(TableNames.WEEKLY_STATISTICS, new WeekStatisticsDAO());
		}
		return (WeekStatisticsDAO) this.daoMap.get(TableNames.WEEKLY_STATISTICS);
	}

}
